{% extends "base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block head_title %}{% if organization %}{% trans "Édition de l’établissement" %}{% else %}{% trans "Nouvel établissement" %}{% endif %}{% endblock %}

{% block bootstrap3_extra_head %}
{{ form.media.css }}
{% endblock %}
{% block bootstrap3_extra_script %}
{{ form.media.js }}
{% endblock %}

{% block content %}
    <h1>{% if organization %}{% trans "Édition de l’établissement" %}{% else %}{% trans "Nouvel établissement" %}{% endif %}</h1>


    <form method="POST" action="" class="form-horizontal">
        {% csrf_token %}
        <div>
            <div role="tabpanel" class="tab-pane active" id="addr">
                {% bootstrap_field form.abbr layout='horizontal' size='small' %}
                {% bootstrap_field form.name layout='horizontal' size='small' %}
                {% include "address_bootstrap_form.html" with has_additional=True %}
                {% bootstrap_field form.website layout='horizontal' size='small' %}
            </div>
            <div role="tabpanel" class="tab-pane active" id="coord">
                {% bootstrap_field form.coordinator layout='horizontal' size='small' %}
            </div>
            <div role="tabpanel" class="tab-pane active" id="comments">
                {% bootstrap_field form.status layout='horizontal' size='small' %}
                {% if form.comments %}
                    {% bootstrap_field form.comments layout='horizontal' size='small' %}
                {% endif %}
            </div>
        </div>

        {% buttons %}
            <button type="submit" class="btn btn-primary pull-right">{% trans "Enregistrer" %}</button>
            {% if organization %}
                <a class="btn btn-default" href="{% url 'organization-detail' pk=organization.pk %}">{% trans "Annuler" %}</a>
            {% else %}
                <a class="btn btn-default" href="{% url 'organization-list' %}">{% trans "Annuler" %}</a>
            {% endif %}
        {% endbuttons %}
    </form>
{% endblock %}
